<template>
  <div>
<h1>用户投资明细</h1>
用户名称:<input type="text" v-model="state.userName">
投资时间:<input type="date" v-model="state.Kai">-<input type="date" v-model="state.Jie">
<input type="button" value="查询" @click="show">
<table>
  <tr>
    <td>用户名称</td>
    <td>用户投资金额</td>
    <td>投资时间</td>
  </tr>
  <tr v-for="item in list">
    <td>{{item.userName}}</td>
    <td>{{item.JinE}}</td>
    <td>{{item.YHDate.substr(0,10)}}</td>
  </tr>
</table>
  </div>
</template>

<script setup lang="ts">
import {reactive,toRefs,onMounted} from 'vue'
import axios from 'axios'
import {useRoute,useRouter} from 'vue-router'
const router=useRouter()
const route=useRoute()

let data:any=reactive({
  state:{
    userName:'',
    Kai:'',
    Jie:''
  },
  list:[]
})

let {state,list}=toRefs(data)

onMounted(()=>{
  show()
})

const show=()=>{
axios({
  url:'api/XinXi/GeyShouYongHu',
  method:'get',
  params:state.value
})
.then(res=>{
  console.log(res.data);
  list.value=res.data.data;
  console.log(res.data.data.length);
})
.catch(err=>{
  console.log(err);
  
})
}
</script>

<style scoped>

</style>